package com.aspose.cells;

class zbtq {
   private static final com.aspose.cells.b.c.a.za a = new com.aspose.cells.b.c.a.za(new String[]{"#DIV/0!", "#N/A", "#NAME?", "#NULL!", "#NUM!", "#REF!", "#VALUE!"});

   public static DateTime a(double var0, boolean var2) {
      if (var0 > 2958465.99D) {
         return DateTime.b;
      } else {
         if (var2) {
            var0 += 1462.0D;
         }

         if (var0 < 60.0D) {
            ++var0;
         }

         return DateTime.b(var0);
      }
   }

   public static double a(DateTime var0, boolean var1) {
      com.aspose.cells.b.a.zk var2;
      double var3;
      if (var1) {
         var2 = com.aspose.cells.a.c.zk.e(var0, zml.m);
         var3 = var2.c();
         return var3 < 0.0D ? -1.0D : var3;
      } else {
         var2 = com.aspose.cells.a.c.zk.e(DateTime.b, var0);
         if (var2.c() < 0.0D) {
            return -1.0D;
         } else {
            var2 = com.aspose.cells.a.c.zk.e(var0, zml.l);
            if (var2.c() > 0.0D) {
               var2 = com.aspose.cells.a.c.zk.e(var0, zml.n);
            } else {
               var2 = com.aspose.cells.a.c.zk.e(var0, zml.o);
            }

            if (var2.c() < 0.0D) {
               return -1.0D;
            } else {
               var3 = var2.c();
               if (var0.getYear() == 1900 && var0.getMonth() == 3 && var0.getDay() == 1) {
                  ++var3;
               }

               return var3;
            }
         }
      }
   }

   static boolean a(String var0) {
      if (var0 != null && var0.length() != 0) {
         if (var0.charAt(0) != '#') {
            return false;
         } else {
            switch(a.a(var0)) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
               return true;
            default:
               return false;
            }
         }
      } else {
         return false;
      }
   }
}
